package com.zhou.controller;

import com.zhou.dto.Result;
import com.zhou.entity.Course;
import com.zhou.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("course")
public class CourseController {
    @Autowired
    private CourseService courseService;

    @CrossOrigin
    @RequestMapping("findAll")
    public Result findAll(){
        List<Course> courses = courseService.findAll();
        return Result.SUCCESS.setNewData(courses);
    }
}
